package cn.itsource.pethome.org.service.impl;

import cn.itsource.pethome.base.service.impl.BaseServiceImpl;
import cn.itsource.pethome.org.domain.Employee;
import cn.itsource.pethome.org.domain.Shop;
import cn.itsource.pethome.org.mapper.EmployeeMapper;
import cn.itsource.pethome.org.mapper.ShopMapper;
import cn.itsource.pethome.org.service.IShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ShopServiceImpl extends BaseServiceImpl<Shop> implements IShopService {
    @Autowired
    private ShopMapper shopMapper;

    @Autowired
    private EmployeeMapper employeeMapper;


    @Override
    @Transactional
    public void settledIn(Shop shop) {
        System.out.println(shop);
        Employee admin = shop.getAdmin();
        admin.setState(1);

        /*保存员工的审核状态*/
        employeeMapper.save(admin);

        /*保存商家上传的详细信息*/
        shopMapper.save(shop);


    }
}
